package com.slz3.business.module.goodsManagement.gooTypeLevel1.steward;

import com.slz3.business.frame.functions.Add;
import com.slz3.business.frame.functions.Modify;
import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.steward.Steward;
import com.slz3.business.frame.util.VE;
import com.slz3.business.module.goodsManagement.gooTypeLevel1.domain.GooTypeLevel1;
import com.slz3.business.module.goodsManagement.gooTypeLevel1.domain.GooTypeLevel1Condition;
import org.springframework.web.reactive.function.server.ServerRequest;


public class GooTypeLevel1ResUnsafeValid {

    public static boolean add(ServerRequest req, GooTypeLevel1 gooTypeLevel1) {
        Steward.constraintViolations(req, gooTypeLevel1, Add.class);
        return RR.hasResErr(req);
    }

    public static boolean delete(ServerRequest req, GooTypeLevel1Condition gooTypeLevel1Condition) {
        if (VE.isEmpty(gooTypeLevel1Condition.getUuidList())) {
            RR.resDetail(req).put("uuidList", "must not null");
        } else if (gooTypeLevel1Condition.getUuidList().size() > 800) {
            RR.resDetail(req).put("uuidList", "uuidList max size is 800");
        }
        return RR.hasResErr(req);
    }

    static boolean modify(ServerRequest req, GooTypeLevel1 gooTypeLevel1) {
        Steward.constraintViolations(req, gooTypeLevel1, Modify.class);
        return RR.hasResErr(req);
    }

    public static boolean list(ServerRequest req) {
        return RR.hasResErr(req);
    }

    public static boolean info(ServerRequest req) {
        if (VE.isEmpty(req.queryParam("uuid").orElse(null))) {
            RR.resDetail(req).put("uuid", "must not null");
        }
        return RR.hasResErr(req);
    }

    public static boolean choice(ServerRequest req) {
        return RR.hasResErr(req);
    }

    public static boolean auditSubmit(ServerRequest req, GooTypeLevel1Condition gooTypeLevel1Condition) {
        if (VE.isEmpty(gooTypeLevel1Condition.getUuidList())) {
            RR.resDetail(req).put("uuidList", "must not null");
        } else if (gooTypeLevel1Condition.getUuidList().size() > 800) {
            RR.resDetail(req).put("uuidList", "uuidList max size is 800");
        }
        return RR.hasResErr(req);
    }

    public static boolean audit(ServerRequest req, GooTypeLevel1Condition gooTypeLevel1Condition) {
        if (VE.isEmpty(gooTypeLevel1Condition.getUuidList())) {
            RR.resDetail(req).put("uuidList", "must not null");
        } else if (gooTypeLevel1Condition.getUuidList().size() > 800) {
            RR.resDetail(req).put("uuidList", "uuidList max size is 800");
        }
        return RR.hasResErr(req);
    }

    public static boolean auditReject(ServerRequest req, GooTypeLevel1Condition gooTypeLevel1Condition) {
        if (VE.isEmpty(gooTypeLevel1Condition.getUuidList())) {
            RR.resDetail(req).put("uuidList", "must not null");
        } else if (gooTypeLevel1Condition.getUuidList().size() > 800) {
            RR.resDetail(req).put("uuidList", "uuidList max size is 800");
        }
        return RR.hasResErr(req);
    }

    public static boolean usingEnable(ServerRequest req, GooTypeLevel1Condition gooTypeLevel1Condition) {
        if (VE.isEmpty(gooTypeLevel1Condition.getUuidList())) {
            RR.resDetail(req).put("uuidList", "must not null");
        } else if (gooTypeLevel1Condition.getUuidList().size() > 800) {
            RR.resDetail(req).put("uuidList", "uuidList max size is 800");
        }
        return RR.hasResErr(req);
    }

    public static boolean usingDisable(ServerRequest req, GooTypeLevel1Condition gooTypeLevel1Condition) {
        if (VE.isEmpty(gooTypeLevel1Condition.getUuidList())) {
            RR.resDetail(req).put("uuidList", "must not null");
        } else if (gooTypeLevel1Condition.getUuidList().size() > 800) {
            RR.resDetail(req).put("uuidList", "uuidList max size is 800");
        }
        return RR.hasResErr(req);
    }
}
